﻿using System;
using System.Data;
using OOXMLGenerator.Enums;

namespace OOXMLGenerator.DataStructure
{
    /// <summary>
    /// Represents the structure of a section of template content:
    /// header, a table for data and a type.
    /// </summary>
    public class SectionContent
    {
        #region Public Members
        /// <summary>
        /// Section header
        /// </summary>
        public string Header { get; set; }
        /// <summary>
        /// DataTable for section data
        /// </summary>
        public DataTable Content { get; set; }
        /// <summary>
        /// Section type
        /// </summary>
        public PartContentType Type { get; set; }
        #endregion

        #region Constructors
        /// <summary>
        /// Empty constructor - initializes a new instance of the SectionContent Class.
        /// </summary>
        public SectionContent() { }
        
        /// <summary>
        /// Initializes a SectionContent object with given parameters.
        /// </summary>
        /// <param name="header">header:string - for section header</param>
        /// <param name="content">content:DataTable - for section content data</param>
        /// <param name="type">type:PartContentType - to define section type</param>
        public SectionContent(string header, DataTable content, PartContentType type)
        {
            Header = header;
            Content = content.Copy();
            Content.AcceptChanges();
            Type = type;
        }

        /// <summary>
        /// Creates a copy of given SectionContent parameter.
        /// </summary>
        /// <param name="sectionContent">sectionContent:SectionContent - contains the structure that has to be copied 
        /// for the new SectionContent object</param>
        public SectionContent(SectionContent sectionContent)
        {
            Header = sectionContent.Header;
            Content = sectionContent.Content.Copy();
            Content.AcceptChanges();
            Type = sectionContent.Type;
        }
        #endregion
    }
}
